import React, { Component } from 'react'
import PubSub from "pubsub-js"

export default class username extends Component {
    constructor(props) {
        super(props)
        this.state = {}
    }
    changeUsername = (event) => {
        //console.log(event.target.value);
        // this.props.addUsername(event.target.value);
        PubSub.publish("addUsername",event.target.value)
    }
    render() {
        //console.log(this.props,"------------");
        return (
            <div className="username">
                用户名<br />
                {/* <input type="text" placeholder="请输入您的用户名"
                    ref={(input) => this.inputUsername = input} /> */}
                <input type="text" placeholder="请输入您的用户名" 
                 onChange={this.changeUsername}   />
            </div>
        )
    }
}
